/**
 * @(#)BoundedTypeDemo.java, 2020/8/21.
 * <p/>
 * Copyright 2020 Netease, Inc. All rights reserved.
 * NETEASE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package com.lhh.myspringboot.Boke;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.HashBiMap;
import com.lhh.myspringboot.bean.Admin;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Rectangle;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Locale;
import java.util.TimeZone;

/**
 * @author lvhouhou(lvhouhou @ 163.com)
 */
public class BoundedTypeDemo {
   /* public static void main(String[] args){
        Rectangle rectangle = new Rectangle(2, 2);
        Circle circle = new Circle(2);

        System.out.println("Same area ?" + equalArea(rectangle, circle));

    }

    public static <E extends GeometricObject> boolean equalArea(E object1, E object2){

        return object1.getArea() == object2.getArea();

    }*/

   public static void main(String[] args) throws ParseException {

       String utcTimeStr = getUTCTimeStr();
       //PageInfo;
       int page =1;
       int size =1;
      // PageHelper.startPage(page, size);

   }


   /*获取UTC时间 */
    public static String getUTCTimeStr(){
        LocalDateTime now = LocalDateTime.now(ZoneOffset.UTC);
        System.out.println(now);
        return now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
    }



    public static Date getCST(String strGMT) throws ParseException {

        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
        //DateFormat df = new SimpleDateFormat("EEE, d-MMM-yyyy HH:mm:ss z", Locale.CHINA);

        return df.parse(strGMT);

    }

    public static void  g(String strGMT) throws ParseException {

       /*String time = "2020-04-16T17:27:38.000+0000";
       time = time.substring(0, time.length() - 9).replace("T"," ");*/
        //System.out.println(time);

      /* GregorianCalendar calendar = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
       calendar.setTime(new Date());

       Date start = calendar.getTime();
       System.out.println("start:"+start);

       SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
       String format = df.format(start);
       System.out.println("format:"+format);
       Date s = getCST(format);
       System.out.println("s:" +s);*/

        GregorianCalendar calendar = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
        calendar.setTime(new Date());

        Date start = calendar.getTime();

        calendar.add(Calendar.HOUR, 2);                //可以结合日历来更加方便灵活地处理日期
        Date end  = calendar.getTime();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");    //这里是重点

        String s= sdf.format(start);
        String e= sdf.format(end);

    }
}
